const App = getApp();
const navigationBarHeight = (getApp().diygwstatusBarHeight + 44) + 'px'
Page({
    data: {
        tabs1:[],
activeIndex1:0,
scrollLeft:0,

msgs1:[],
url:App.Config.basePath,

    },

    //弹出提示信息
    showModal(message) {
        App.WxService.showModal({
            title: '友情提示',
            content: message,
            showCancel: !1,
        });
    },
    onShareAppMessage: function() {},

    //页面加载
    onLoad(option) {
        if (option) {
            this.setData({
                globalOption: option
            })
        }
    },

    //页面显示
    onShow() {
        this.getMsgs1();
this.getMsgs2();
    },

    //页面跳转
    navigateTo(e) {
        App.navigateTo(e.currentTarget.dataset.url, e.currentTarget.dataset);
    },
    //tab切换事件
tabClick1: function (e) {
	const dataset = e.currentTarget.dataset;
    this.setData({
        activeIndex1: dataset.id,
        scrollLeft: (e.currentTarget.dataset.id-1)*60
    });
    this.getMsgs2();
},

getMsgs1() {
    //设置要传递的参数
    let param = {
        f: 1,
        loadmsg: `正在加载中`
    };

    App.HttpService.getData(param, "/ptype_List").then(data => { //执行服务器Servlet
        this.setData({
            tabs1: data //把从服务器端得到的值赋值给数组
        });
    });
},
    getMsgs2() {
        //设置要传递的参数
        let param = {
            f: 2,
            t: App.globalData.sk != "" ? 0 : (this.data.activeIndex1 == 0 ? 0 : this.data.tabs1[this.data.activeIndex1].tid),
            k: App.globalData.sk,
            loadmsg: `正在加载中`
        };

        App.HttpService.getData(param, "/products_List").then(data => { //执行服务器Servlet
            this.setData({
                msgs1: data //把从服务器端得到的值赋值给数组
            });
        });

        if(App.globalData.sk!="")
        {
            App.globalData.sk="";
        }
    },

})